home *** CD-ROM | disk | FTP | other *** search
Text File | 2000-09-28 | 2.9 KB | 117 lines | [TEXT/CWIE] |
- unit AsyncDriverCommon;
-
- (*
- File: AsyncDriverCommon.p
-
- Contains: Declarations common to the driver and the DropMounter utility.
-
- Written by: Quinn "The Eskimo!"
-
- Copyright: © 1996 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- You may incorporate this sample code into your applications without
- restriction, though the sample code has been provided "AS IS" and the
- responsibility for its operation is 100% yours. However, what you are
- not permitted to do is to redistribute the source as "DSC Sample Code"
- after having made changes. If you're going to re-distribute the source,
- we require that you make it clear in the source that the code was
- descended from Apple Sample Code, but that you've made changes.
- *)
-
- interface
-
- uses
- Types,
- OSUtils,
- Files;
-
- {$PUSH}
- {$ALIGN MAC68K}
-
- (* This is the magic control code that DropMounter sends to
- the device driver in response to a disk image being
- drop on to the application.
- Note that this choice is not accidental. By setting the
- DriverGestalt bit in our dctlFlags, we're saying that
- we won't use any csCodes below 128 for our private
- functions.
- *)
-
- const
- kMountImageControlCode = 128;
-
- (* This is the format of the param block used for the
- above control code.
- *)
-
- type
- MountParamBlock =
- record
- qLink: QElemPtr;
- qType: integer;
- ioTrap: integer;
- ioCmdAddr: Ptr;
- ioCompletion: ProcPtr;
- ioResult: OSErr;
- ioNamePtr: StringPtr;
- ioVRefNum: integer;
- ioCRefNum: integer;
- csCode: integer;
- csParamFileToMount: FSSpecPtr;
- end;
- MountParamBlockPtr = ^MountParamBlock;
-
- (* This is the magic control code that DropMounter sends to
- the device driver immediately after opening it. It contains
- the information that the device driver would otherwise
- have to get using the Resource Manager. I wanted to keep this
- out of my device driver because:
-
- 1. Device drivers should not access the toolbox -- While it's
- impossible to write a traditional device driver without using Toolbox
- calls, it's still a good idea to keep them off the Toolbox as much
- as possible.
-
- 2. Minimises the driver code size.
- *)
-
- const
- kSecondaryInitControlCode = 129;
-
- (* This is the format of the param block used for the
- above control code.
- *)
-
- type
- IconType = packed array[0..255] of Byte;
- IconTypePtr = ^IconType;
-
- type
- SecondaryInitParamBlock =
- record
- qLink: QElemPtr;
- qType: integer;
- ioTrap: integer;
- ioCmdAddr: Ptr;
- ioCompletion: ProcPtr;
- ioResult: OSErr;
- ioNamePtr: StringPtr;
- ioVRefNum: integer;
- ioCRefNum: integer;
- csCode: integer;
- csParamVersion : NumVersion;
- csParamMediaIcon : IconType;
- csParamMediaDescription : Str255;
- csParamPhysicalIcon : IconType;
- csParamPhysicalDescription : Str255;
- end;
- SecondaryInitParamBlockPtr = ^SecondaryInitParamBlock;
-
- {$ALIGN RESET}
- {$POP}
-
- implementation
-
- end. (* AsyncDriverCommon *)